<?php

# mvblogs_2-0
# 2006 Oct 06  08:47:26
# returns the current session user. defaults to guest when a session is not
# yet authenticated by a user

function getSessionUser()
{
    if (isset($GLOBALS['USER']) &&
        stristr(get_class($GLOBALS['USER']), 'user')) {
        return $GLOBALS['USER'];
    }

    # if user is not set or is of invalid class throw an exception
    throw new Exception('could not get session user object');
}